//
//  HotSelListCollectionViewCell.m
//  GiftItems
//
//  Created by lanou3g on 15/9/20.
//  Copyright (c) 2015年 lanou3g. All rights reserved.
//

#import "HotSelListCollectionViewCell.h"
#import "HotSelListModel.h"
#define kCellWidth self.frame.size.width
#define kCellHeight self.frame.size.height
@implementation HotSelListCollectionViewCell
-(void)setValueForArrtibutesWithModel:(HotSelListModel *)model {
    
    [self.picView sd_setImageWithURL:[NSURL URLWithString:model.cover_image_url] placeholderImage:[UIImage imageNamed:@"119"]];
    self.title.text = model.name;
    self.priceLabel.text = [NSString stringWithFormat:@"%@",model.price];
    self.likeNum.text = [NSString stringWithFormat:@"%@",model.favorites_count];
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self addSubViews];
    }
    return self;
}
- (void)addSubViews {
    // 设置物品的图片
    self.picView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kCellWidth, kCellHeight - 60)];
    self.picView.layer.masksToBounds = YES;
    self.picView.layer.cornerRadius = 5;
    [self.contentView addSubview:self.picView];
    
    // 设置物品的标题
    self.title = [[UILabel alloc] initWithFrame:CGRectMake(0, kCellHeight- 60, kCellWidth, 40)];
    [self setLabel:self.title];
    
    // 设置价钱的图标
    self.icon = [[UIImageView alloc] initWithFrame:CGRectMake(kCellWidth - 63, kCellHeight - 19, 20, 20)];
    self.icon.image = [UIImage imageNamed:@"FontAwesome_f157(0)_32"];
    [self.contentView addSubview:self.icon];
    
    // 设置价钱
    self.priceLabel = [[UILabel alloc] initWithFrame:CGRectMake(kCellWidth - 45, kCellHeight - 25, 60, 30)];
    [self setLabel:self.priceLabel];
    
    // 设置人气图标
    self.iconView = [[UIImageView alloc] initWithFrame:CGRectMake(-5, 170, 40, 40)];
    self.iconView.image = [UIImage imageNamed:@"Entypo_2661(0)_64"];
    [self.contentView addSubview:self.iconView];
    
    // 设置人气数目
    self.likeNum = [[UILabel alloc] initWithFrame:CGRectMake(35, 175,kCellWidth - 100, kCellHeight - 170)];
    [self setLabel:self.likeNum];
    
}
// 设置Label的属性
- (void)setLabel:(UILabel *)label{
    label.textAlignment = NSTextAlignmentLeft;
    label.numberOfLines = 2;
    label.textColor = kRGB(255.0, 235.0,255.0);
    label.font = [UIFont boldSystemFontOfSize:12.5];
    [self.contentView addSubview:label];
}




@end
